home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / SCSI.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  55.3 KB  |  1,140 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        SCSI.h
  3.  
  4.      Contains:    SCSI Family Interfaces.
  5.  
  6.      Version:    Technology:    SCSI 4.3
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1986-1999 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __SCSI__
  18. #define __SCSI__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __MIXEDMODE__
  25.     #include <MixedMode.h>
  26. #endif
  27.  
  28.  
  29.  
  30.  
  31. #if PRAGMA_ONCE
  32. #pragma once
  33. #endif
  34.  
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38.  
  39. #if PRAGMA_IMPORT
  40. #pragma import on
  41. #endif
  42.  
  43. #if PRAGMA_STRUCT_ALIGN
  44.     #pragma options align=mac68k
  45. #elif PRAGMA_STRUCT_PACKPUSH
  46.     #pragma pack(push, 2)
  47. #elif PRAGMA_STRUCT_PACK
  48.     #pragma pack(2)
  49. #endif
  50.  
  51. /* SCSI Manager errors. These are generated by Inside Mac IV calls only. */
  52. enum {
  53.     scCommErr                    = 2,                            /* communications error, operation timeout */
  54.     scArbNBErr                    = 3,                            /* arbitration timeout waiting for not BSY */
  55.     scBadParmsErr                = 4,                            /* bad parameter or TIB opcode */
  56.     scPhaseErr                    = 5,                            /* SCSI bus not in correct phase for attempted operation */
  57.     scCompareErr                = 6,                            /* data compare error */
  58.     scMgrBusyErr                = 7,                            /* SCSI Manager busy  */
  59.     scSequenceErr                = 8,                            /* attempted operation is out of sequence */
  60.     scBusTOErr                    = 9,                            /* CPU bus timeout */
  61.     scComplPhaseErr                = 10                            /* SCSI bus wasn't in Status phase */
  62. };
  63.  
  64. /* TIB opcodes */
  65. enum {
  66.     scInc                        = 1,
  67.     scNoInc                        = 2,
  68.     scAdd                        = 3,
  69.     scMove                        = 4,
  70.     scLoop                        = 5,
  71.     scNop                        = 6,
  72.     scStop                        = 7,
  73.     scComp                        = 8
  74. };
  75.  
  76. /* Signatures */
  77. enum {
  78.     sbSIGWord                    = 0x4552,                        /* signature word for Block 0 ('ER') */
  79.     sbMac                        = 1,                            /* system type for Mac */
  80.     pMapSIG                        = 0x504D,                        /* partition map signature ('PM') */
  81.     pdSigWord                    = 0x5453
  82. };
  83.  
  84. enum {
  85.     oldPMSigWord                = pdSigWord,
  86.     newPMSigWord                = pMapSIG
  87. };
  88.  
  89. /* Driver Descriptor Map */
  90.  
  91. struct Block0 {
  92.     unsigned short                     sbSig;                        /* unique value for SCSI block 0 */
  93.     unsigned short                     sbBlkSize;                    /* block size of device */
  94.     unsigned long                     sbBlkCount;                    /* number of blocks on device */
  95.     unsigned short                     sbDevType;                    /* device type */
  96.     unsigned short                     sbDevId;                    /* device id */
  97.     unsigned long                     sbData;                        /* not used */
  98.     unsigned short                     sbDrvrCount;                /* driver descriptor count */
  99.     unsigned long                     ddBlock;                    /* 1st driver's starting block */
  100.     unsigned short                     ddSize;                        /* size of 1st driver (512-byte blks) */
  101.     unsigned short                     ddType;                        /* system type (1 for Mac+) */
  102.     unsigned short                     ddPad[243];                    /* ARRAY[0..242] OF INTEGER; not used */
  103. };
  104. typedef struct Block0                    Block0;
  105. /* Driver descriptor */
  106.  
  107. struct DDMap {
  108.     unsigned long                     ddBlock;                    /* 1st driver's starting block */
  109.     unsigned short                     ddSize;                        /* size of 1st driver (512-byte blks) */
  110.     unsigned short                     ddType;                        /* system type (1 for Mac+) */
  111. };
  112. typedef struct DDMap                    DDMap;
  113. /* Partition Map Entry */
  114.  
  115. struct Partition {
  116.     unsigned short                     pmSig;                        /* unique value for map entry blk */
  117.     unsigned short                     pmSigPad;                    /* currently unused */
  118.     unsigned long                     pmMapBlkCnt;                /* # of blks in partition map */
  119.     unsigned long                     pmPyPartStart;                /* physical start blk of partition */
  120.     unsigned long                     pmPartBlkCnt;                /* # of blks in this partition */
  121.     unsigned char                     pmPartName[32];                /* ASCII partition name */
  122.     unsigned char                     pmParType[32];                /* ASCII partition type */
  123.     unsigned long                     pmLgDataStart;                /* log. # of partition's 1st data blk */
  124.     unsigned long                     pmDataCnt;                    /* # of blks in partition's data area */
  125.     unsigned long                     pmPartStatus;                /* bit field for partition status */
  126.     unsigned long                     pmLgBootStart;                /* log. blk of partition's boot code */
  127.     unsigned long                     pmBootSize;                    /* number of bytes in boot code */
  128.     unsigned long                     pmBootAddr;                    /* memory load address of boot code */
  129.     unsigned long                     pmBootAddr2;                /* currently unused */
  130.     unsigned long                     pmBootEntry;                /* entry point of boot code */
  131.     unsigned long                     pmBootEntry2;                /* currently unused */
  132.     unsigned long                     pmBootCksum;                /* checksum of boot code */
  133.     unsigned char                     pmProcessor[16];            /* ASCII for the processor type */
  134.     unsigned short                     pmPad[188];                    /* ARRAY[0..187] OF INTEGER; not used */
  135. };
  136. typedef struct Partition                Partition;
  137. /* TIB instruction */
  138.  
  139. struct SCSIInstr {
  140.     unsigned short                     scOpcode;
  141.     long                             scParam1;
  142.     long                             scParam2;
  143. };
  144. typedef struct SCSIInstr                SCSIInstr;
  145. /* SCSI Phases (used by SIMs to support the Original SCSI Manager */
  146. enum {
  147.     kDataOutPhase                = 0,                            /* Encoded MSG, C/D, I/O bits */
  148.     kDataInPhase                = 1,
  149.     kCommandPhase                = 2,
  150.     kStatusPhase                = 3,
  151.     kPhaseIllegal0                = 4,
  152.     kPhaseIllegal1                = 5,
  153.     kMessageOutPhase            = 6,
  154.     kMessageInPhase                = 7,
  155.     kBusFreePhase                = 8,                            /* Additional Phases */
  156.     kArbitratePhase                = 9,
  157.     kSelectPhase                = 10,
  158.     kMessageInPhaseNACK            = 11                            /* Message In Phase with ACK hanging on the bus */
  159. };
  160.  
  161.  
  162. EXTERN_API( OSErr )
  163. SCSIReset                        (void)                                                        TWOWORDINLINE(0x4267, 0xA815);
  164.  
  165. EXTERN_API( OSErr )
  166. SCSIGet                            (void)                                                        THREEWORDINLINE(0x3F3C, 0x0001, 0xA815);
  167.  
  168. EXTERN_API( OSErr )
  169. SCSISelect                        (short                     targetID)                            THREEWORDINLINE(0x3F3C, 0x0002, 0xA815);
  170.  
  171. EXTERN_API( OSErr )
  172. SCSICmd                            (Ptr                     buffer,
  173.                                  short                     count)                                THREEWORDINLINE(0x3F3C, 0x0003, 0xA815);
  174.  
  175. EXTERN_API( OSErr )
  176. SCSIRead                        (Ptr                     tibPtr)                                THREEWORDINLINE(0x3F3C, 0x0005, 0xA815);
  177.  
  178. EXTERN_API( OSErr )
  179. SCSIRBlind                        (Ptr                     tibPtr)                                THREEWORDINLINE(0x3F3C, 0x0008, 0xA815);
  180.  
  181. EXTERN_API( OSErr )
  182. SCSIWrite                        (Ptr                     tibPtr)                                THREEWORDINLINE(0x3F3C, 0x0006, 0xA815);
  183.  
  184. EXTERN_API( OSErr )
  185. SCSIWBlind                        (Ptr                     tibPtr)                                THREEWORDINLINE(0x3F3C, 0x0009, 0xA815);
  186.  
  187. EXTERN_API( OSErr )
  188. SCSIComplete                    (short *                stat,
  189.                                  short *                message,
  190.                                  unsigned long             wait)                                THREEWORDINLINE(0x3F3C, 0x0004, 0xA815);
  191.  
  192. EXTERN_API( short )
  193. SCSIStat                        (void)                                                        THREEWORDINLINE(0x3F3C, 0x000A, 0xA815);
  194.  
  195. EXTERN_API( OSErr )
  196. SCSISelAtn                        (short                     targetID)                            THREEWORDINLINE(0x3F3C, 0x000B, 0xA815);
  197.  
  198. EXTERN_API( OSErr )
  199. SCSIMsgIn                        (short *                message)                            THREEWORDINLINE(0x3F3C, 0x000C, 0xA815);
  200.  
  201. EXTERN_API( OSErr )
  202. SCSIMsgOut                        (short                     message)                            THREEWORDINLINE(0x3F3C, 0x000D, 0xA815);
  203.  
  204.  
  205. enum {
  206.     scsiVERSION                    = 43
  207. };
  208.  
  209.  
  210. /*
  211.  * SCSI Callback Procedure Prototypes. Several of these are only callable
  212.  * from SCSI Manager 4.3 SIM and XPT contexts. 
  213.  */
  214. typedef CALLBACK_API_C( void , AENCallbackProcPtr )(void );
  215. typedef CALLBACK_API_C( OSErr , SIMInitProcPtr )(Ptr SIMinfoPtr);
  216. typedef CALLBACK_API_C( void , SIMActionProcPtr )(void *scsiPB, Ptr SIMGlobals);
  217. typedef CALLBACK_API_C( void , SCSIProcPtr )(void );
  218. typedef CALLBACK_API_C( void , SCSIMakeCallbackProcPtr )(void *scsiPB);
  219. /* SCSIInterruptPollProcPtr is obsolete (use SCSIInterruptProcPtr) but still here for compatibility */
  220. typedef CALLBACK_API_C( long , SCSIInterruptPollProcPtr )(Ptr SIMGlobals);
  221. typedef CALLBACK_API_C( long , SCSIInterruptProcPtr )(Ptr SIMGlobals);
  222. typedef STACK_UPP_TYPE(AENCallbackProcPtr)                         AENCallbackUPP;
  223. typedef STACK_UPP_TYPE(SIMInitProcPtr)                             SIMInitUPP;
  224. typedef STACK_UPP_TYPE(SIMActionProcPtr)                         SIMActionUPP;
  225. typedef STACK_UPP_TYPE(SCSIProcPtr)                             SCSIUPP;
  226. typedef STACK_UPP_TYPE(SCSIMakeCallbackProcPtr)                 SCSIMakeCallbackUPP;
  227. typedef STACK_UPP_TYPE(SCSIInterruptPollProcPtr)                 SCSIInterruptPollUPP;
  228. typedef STACK_UPP_TYPE(SCSIInterruptProcPtr)                     SCSIInterruptUPP;
  229. typedef CALLBACK_API( void , SCSICallbackProcPtr )(void *scsiPB);
  230. typedef STACK_UPP_TYPE(SCSICallbackProcPtr)                     SCSICallbackUPP;
  231. #if OPAQUE_UPP_TYPES
  232.     EXTERN_API(AENCallbackUPP)
  233.     NewAENCallbackUPP               (AENCallbackProcPtr        userRoutine);
  234.  
  235.     EXTERN_API(SIMInitUPP)
  236.     NewSIMInitUPP                   (SIMInitProcPtr            userRoutine);
  237.  
  238.     EXTERN_API(SIMActionUPP)
  239.     NewSIMActionUPP                   (SIMActionProcPtr        userRoutine);
  240.  
  241.     EXTERN_API(SCSIUPP)
  242.     NewSCSIUPP                       (SCSIProcPtr                userRoutine);
  243.  
  244.     EXTERN_API(SCSIMakeCallbackUPP)
  245.     NewSCSIMakeCallbackUPP           (SCSIMakeCallbackProcPtr    userRoutine);
  246.  
  247.     EXTERN_API(SCSIInterruptPollUPP)
  248.     NewSCSIInterruptPollUPP           (SCSIInterruptPollProcPtr userRoutine);
  249.  
  250.     EXTERN_API(SCSIInterruptUPP)
  251.     NewSCSIInterruptUPP               (SCSIInterruptProcPtr    userRoutine);
  252.  
  253.     EXTERN_API(SCSICallbackUPP)
  254.     NewSCSICallbackUPP               (SCSICallbackProcPtr        userRoutine);
  255.  
  256.     EXTERN_API(void)
  257.     DisposeAENCallbackUPP           (AENCallbackUPP            userUPP);
  258.  
  259.     EXTERN_API(void)
  260.     DisposeSIMInitUPP               (SIMInitUPP                userUPP);
  261.  
  262.     EXTERN_API(void)
  263.     DisposeSIMActionUPP               (SIMActionUPP            userUPP);
  264.  
  265.     EXTERN_API(void)
  266.     DisposeSCSIUPP                   (SCSIUPP                    userUPP);
  267.  
  268.     EXTERN_API(void)
  269.     DisposeSCSIMakeCallbackUPP       (SCSIMakeCallbackUPP        userUPP);
  270.  
  271.     EXTERN_API(void)
  272.     DisposeSCSIInterruptPollUPP       (SCSIInterruptPollUPP    userUPP);
  273.  
  274.     EXTERN_API(void)
  275.     DisposeSCSIInterruptUPP           (SCSIInterruptUPP        userUPP);
  276.  
  277.     EXTERN_API(void)
  278.     DisposeSCSICallbackUPP           (SCSICallbackUPP            userUPP);
  279.  
  280.     EXTERN_API(void)
  281.     InvokeAENCallbackUPP           (AENCallbackUPP            userUPP);
  282.  
  283.     EXTERN_API(OSErr)
  284.     InvokeSIMInitUPP               (Ptr                        SIMinfoPtr,
  285.                                     SIMInitUPP                userUPP);
  286.  
  287.     EXTERN_API(void)
  288.     InvokeSIMActionUPP               (void *                    scsiPB,
  289.                                     Ptr                        SIMGlobals,
  290.                                     SIMActionUPP            userUPP);
  291.  
  292.     EXTERN_API(void)
  293.     InvokeSCSIUPP                   (SCSIUPP                    userUPP);
  294.  
  295.     EXTERN_API(void)
  296.     InvokeSCSIMakeCallbackUPP       (void *                    scsiPB,
  297.                                     SCSIMakeCallbackUPP        userUPP);
  298.  
  299.     EXTERN_API(long)
  300.     InvokeSCSIInterruptPollUPP       (Ptr                        SIMGlobals,
  301.                                     SCSIInterruptPollUPP    userUPP);
  302.  
  303.     EXTERN_API(long)
  304.     InvokeSCSIInterruptUPP           (Ptr                        SIMGlobals,
  305.                                     SCSIInterruptUPP        userUPP);
  306.  
  307.     EXTERN_API(void)
  308.     InvokeSCSICallbackUPP           (void *                    scsiPB,
  309.                                     SCSICallbackUPP            userUPP);
  310.  
  311. #else
  312.     enum { uppAENCallbackProcInfo = 0x00000001 };                     /* no_return_value Func() */
  313.     enum { uppSIMInitProcInfo = 0x000000E1 };                         /* 2_bytes Func(4_bytes) */
  314.     enum { uppSIMActionProcInfo = 0x000003C1 };                     /* no_return_value Func(4_bytes, 4_bytes) */
  315.     enum { uppSCSIProcInfo = 0x00000001 };                             /* no_return_value Func() */
  316.     enum { uppSCSIMakeCallbackProcInfo = 0x000000C1 };                 /* no_return_value Func(4_bytes) */
  317.     enum { uppSCSIInterruptPollProcInfo = 0x000000F1 };             /* 4_bytes Func(4_bytes) */
  318.     enum { uppSCSIInterruptProcInfo = 0x000000F1 };                 /* 4_bytes Func(4_bytes) */
  319.     enum { uppSCSICallbackProcInfo = 0x000000C0 };                     /* pascal no_return_value Func(4_bytes) */
  320.     #define NewAENCallbackUPP(userRoutine)                             (AENCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppAENCallbackProcInfo, GetCurrentArchitecture())
  321.     #define NewSIMInitUPP(userRoutine)                                 (SIMInitUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMInitProcInfo, GetCurrentArchitecture())
  322.     #define NewSIMActionUPP(userRoutine)                             (SIMActionUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSIMActionProcInfo, GetCurrentArchitecture())
  323.     #define NewSCSIUPP(userRoutine)                                 (SCSIUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIProcInfo, GetCurrentArchitecture())
  324.     #define NewSCSIMakeCallbackUPP(userRoutine)                     (SCSIMakeCallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIMakeCallbackProcInfo, GetCurrentArchitecture())
  325.     #define NewSCSIInterruptPollUPP(userRoutine)                     (SCSIInterruptPollUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptPollProcInfo, GetCurrentArchitecture())
  326.     #define NewSCSIInterruptUPP(userRoutine)                         (SCSIInterruptUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSIInterruptProcInfo, GetCurrentArchitecture())
  327.     #define NewSCSICallbackUPP(userRoutine)                         (SCSICallbackUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSCSICallbackProcInfo, GetCurrentArchitecture())
  328.     #define DisposeAENCallbackUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  329.     #define DisposeSIMInitUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  330.     #define DisposeSIMActionUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  331.     #define DisposeSCSIUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  332.     #define DisposeSCSIMakeCallbackUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  333.     #define DisposeSCSIInterruptPollUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  334.     #define DisposeSCSIInterruptUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  335.     #define DisposeSCSICallbackUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  336.     #define InvokeAENCallbackUPP(userUPP)                             CALL_ZERO_PARAMETER_UPP((userUPP), uppAENCallbackProcInfo)
  337.     #define InvokeSIMInitUPP(SIMinfoPtr, userUPP)                     (OSErr)CALL_ONE_PARAMETER_UPP((userUPP), uppSIMInitProcInfo, (SIMinfoPtr))
  338.     #define InvokeSIMActionUPP(scsiPB, SIMGlobals, userUPP)         CALL_TWO_PARAMETER_UPP((userUPP), uppSIMActionProcInfo, (scsiPB), (SIMGlobals))
  339.     #define InvokeSCSIUPP(userUPP)                                     CALL_ZERO_PARAMETER_UPP((userUPP), uppSCSIProcInfo)
  340.     #define InvokeSCSIMakeCallbackUPP(scsiPB, userUPP)                 CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIMakeCallbackProcInfo, (scsiPB))
  341.     #define InvokeSCSIInterruptPollUPP(SIMGlobals, userUPP)         (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptPollProcInfo, (SIMGlobals))
  342.     #define InvokeSCSIInterruptUPP(SIMGlobals, userUPP)             (long)CALL_ONE_PARAMETER_UPP((userUPP), uppSCSIInterruptProcInfo, (SIMGlobals))
  343.     #define InvokeSCSICallbackUPP(scsiPB, userUPP)                     CALL_ONE_PARAMETER_UPP((userUPP), uppSCSICallbackProcInfo, (scsiPB))
  344. #endif
  345. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  346. #define NewAENCallbackProc(userRoutine)                         NewAENCallbackUPP(userRoutine)
  347. #define NewSIMInitProc(userRoutine)                             NewSIMInitUPP(userRoutine)
  348. #define NewSIMActionProc(userRoutine)                             NewSIMActionUPP(userRoutine)
  349. #define NewSCSIProc(userRoutine)                                 NewSCSIUPP(userRoutine)
  350. #define NewSCSIMakeCallbackProc(userRoutine)                     NewSCSIMakeCallbackUPP(userRoutine)
  351. #define NewSCSIInterruptPollProc(userRoutine)                     NewSCSIInterruptPollUPP(userRoutine)
  352. #define NewSCSIInterruptProc(userRoutine)                         NewSCSIInterruptUPP(userRoutine)
  353. #define NewSCSICallbackProc(userRoutine)                         NewSCSICallbackUPP(userRoutine)
  354. #define CallAENCallbackProc(userRoutine)                        InvokeAENCallbackUPP(userRoutine)
  355. #define CallSIMInitProc(userRoutine, SIMinfoPtr)                InvokeSIMInitUPP(SIMinfoPtr, userRoutine)
  356. #define CallSIMActionProc(userRoutine, scsiPB, SIMGlobals)        InvokeSIMActionUPP(scsiPB, SIMGlobals, userRoutine)
  357. #define CallSCSIProc(userRoutine)                                InvokeSCSIUPP(userRoutine)
  358. #define CallSCSIMakeCallbackProc(userRoutine, scsiPB)            InvokeSCSIMakeCallbackUPP(scsiPB, userRoutine)
  359. #define CallSCSIInterruptPollProc(userRoutine, SIMGlobals)        InvokeSCSIInterruptPollUPP(SIMGlobals, userRoutine)
  360. #define CallSCSIInterruptProc(userRoutine, SIMGlobals)            InvokeSCSIInterruptUPP(SIMGlobals, userRoutine)
  361. #define CallSCSICallbackProc(userRoutine, scsiPB)                InvokeSCSICallbackUPP(scsiPB, userRoutine)
  362. /* SCSI Manager 4.3 function codes */
  363. enum {
  364.     SCSINop                        = 0x00,                            /* Execute nothing                                         */
  365.     SCSIExecIO                    = 0x01,                            /* Execute the specified IO                             */
  366.     SCSIBusInquiry                = 0x03,                            /* Get parameters for entire path of HBAs                 */
  367.     SCSIReleaseQ                = 0x04,                            /* Release the frozen SIM queue for particular LUN         */
  368.     SCSIAbortCommand            = 0x10,                            /* Abort the selected Control Block                      */
  369.     SCSIResetBus                = 0x11,                            /* Reset the SCSI bus                                      */
  370.     SCSIResetDevice                = 0x12,                            /* Reset the SCSI device                                  */
  371.     SCSITerminateIO                = 0x13,                            /* Terminate any pending IO                              */
  372.     SCSIGetVirtualIDInfo        = 0x80,                            /* Find out which bus old ID is on                         */
  373.     SCSILoadDriver                = 0x82,                            /* Load a driver for a device ident                     */
  374.     SCSIOldCall                    = 0x84,                            /* XPT->SIM private call for old-API                     */
  375.     SCSICreateRefNumXref        = 0x85,                            /* Register a DeviceIdent to drvr RefNum xref             */
  376.     SCSILookupRefNumXref        = 0x86,                            /* Get DeviceIdent to drvr RefNum xref                     */
  377.     SCSIRemoveRefNumXref        = 0x87,                            /* Remove a DeviceIdent to drvr RefNum xref             */
  378.     SCSIRegisterWithNewXPT        = 0x88,                            /* XPT has changed - SIM needs to re-register itself     */
  379.     vendorUnique                = 0xC0                            /* 0xC0 thru 0xFF */
  380. };
  381.  
  382.  
  383. /* Allocation length defines for some of the fields */
  384. enum {
  385.     handshakeDataLength            = 8,                            /* Handshake data length */
  386.     maxCDBLength                = 16,                            /* Space for the CDB bytes/pointer */
  387.     vendorIDLength                = 16                            /* ASCII string len for Vendor ID  */
  388. };
  389.  
  390. /* Define DeviceIdent structure */
  391.  
  392. struct DeviceIdent {
  393.     UInt8                             diReserved;                    /* reserved                 */
  394.     UInt8                             bus;                        /* SCSI - Bus Number        */
  395.     UInt8                             targetID;                    /* SCSI - Target SCSI ID    */
  396.     UInt8                             LUN;                        /* SCSI - LUN                  */
  397. };
  398. typedef struct DeviceIdent                DeviceIdent;
  399. /* Command Descriptor Block structure */
  400.  
  401. union CDB {
  402.     BytePtr                         cdbPtr;                        /* pointer to the CDB, or */
  403.     UInt8                             cdbBytes[16];                /* the actual CDB to send */
  404. };
  405. typedef union CDB                        CDB;
  406. typedef CDB *                            CDBPtr;
  407. /* Scatter/gather list element (Deprecated for MacOS8) */
  408.  
  409. struct SGRecord {
  410.     Ptr                             SGAddr;
  411.     UInt32                             SGCount;
  412. };
  413. typedef struct SGRecord                    SGRecord;
  414.  
  415. #define SCSIPBHdr                         \
  416.     struct SCSIHdr* qLink;                \
  417.     short            scsiReserved1;        \
  418.     UInt16            scsiPBLength;        \
  419.     UInt8            scsiFunctionCode;    \
  420.     UInt8            scsiReserved2;        \
  421.     volatile OSErr    scsiResult;            \
  422.     DeviceIdent        scsiDevice;            \
  423.     SCSICallbackUPP    scsiCompletion;        \
  424.     UInt32            scsiFlags;            \
  425.     UInt8 *            scsiDriverStorage;    \
  426.     Ptr                scsiXPTprivate;        \
  427.     long            scsiReserved3;
  428.  
  429.  
  430. struct SCSIHdr {
  431.     struct SCSIHdr *                qLink;                        /* (internal use, must be nil on entry)    */
  432.     short                             scsiReserved1;                /* ->     reserved for input                */
  433.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  434.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  435.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  436.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  437.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  438.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  439.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  440.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  441.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  442.     long                             scsiReserved3;                /* reserved                                */
  443. };
  444. typedef struct SCSIHdr                    SCSIHdr;
  445.  
  446. struct SCSI_PB {
  447.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  448.     short                             scsiReserved1;                /* ->     reserved for input                */
  449.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  450.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  451.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  452.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  453.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  454.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  455.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  456.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  457.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  458.     long                             scsiReserved3;                /* reserved                                */
  459. };
  460. typedef struct SCSI_PB                    SCSI_PB;
  461.  
  462. struct SCSI_IO {
  463.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  464.     short                             scsiReserved1;                /* ->     reserved for input                */
  465.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  466.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  467.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  468.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  469.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  470.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  471.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  472.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  473.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  474.     long                             scsiReserved3;                /* reserved                                */
  475.  
  476.     UInt16                             scsiResultFlags;            /* <- Flags which modify the scsiResult field        */
  477.     UInt16                             scsiReserved3pt5;            /* -> Reserved                                        */
  478.     BytePtr                         scsiDataPtr;                /* -> Pointer to the data buffer or the S/G list      */
  479.     UInt32                             scsiDataLength;                /* -> Data transfer length                            */
  480.     BytePtr                         scsiSensePtr;                /* -> Ptr to autosense data buffer                  */
  481.     UInt8                             scsiSenseLength;            /* -> size of the autosense buffer                     */
  482.     UInt8                             scsiCDBLength;                /* -> Number of bytes for the CDB                      */
  483.     UInt16                             scsiSGListCount;            /* -> num of scatter gather list entries              */
  484.     UInt32                             scsiReserved4;                /* <-     reserved for output                            */
  485.     UInt8                             scsiSCSIstatus;                /* <- Returned scsi device status                      */
  486.     SInt8                             scsiSenseResidual;            /* <- Autosense residual length                      */
  487.     UInt16                             scsiReserved5;                /* <-     reserved for output                             */
  488.     long                             scsiDataResidual;            /* <- Returned Transfer residual length              */
  489.     CDB                             scsiCDB;                    /* -> Actual CDB or pointer to CDB                  */
  490.     long                             scsiTimeout;                /* -> Timeout value (Time Mgr format) (CAM timeout) */
  491.     BytePtr                         scsiReserved5pt5;            /* -> Reserved                                        */
  492.     UInt16                             scsiReserved5pt6;            /* -> Reserved                                        */
  493.     UInt16                             scsiIOFlags;                /* -> additional I/O flags                               */
  494.     UInt8                             scsiTagAction;                /* -> What to do for tag queuing                       */
  495.     UInt8                             scsiReserved6;                /* ->     reserved for input                             */
  496.     UInt16                             scsiReserved7;                /* ->     reserved for input                             */
  497.     UInt16                             scsiSelectTimeout;            /* -> Select timeout value                             */
  498.     UInt8                             scsiDataType;                /* -> Data description type (i.e. buffer, TIB, S/G)    */
  499.     UInt8                             scsiTransferType;            /* -> Transfer type (i.e. Blind vs Polled)             */
  500.     UInt32                             scsiReserved8;                /* ->     reserved for input                             */
  501.     UInt32                             scsiReserved9;                /* ->     reserved for input                             */
  502.     UInt16                             scsiHandshake[8];            /* -> handshaking points (null term'd)    */
  503.     UInt32                             scsiReserved10;                /* ->     reserved for input                             */
  504.     UInt32                             scsiReserved11;                /* ->   reserved for input                            */
  505.     struct SCSI_IO *                scsiCommandLink;            /* -> Ptr to the next PB in linked cmd chain         */
  506.  
  507.     UInt8                             scsiSIMpublics[8];            /* ->     reserved for input to 3rd-party SIMs        */
  508.     UInt8                             scsiAppleReserved6[8];        /* ->    reserved for input                              */
  509.  
  510.                                                                 /* XPT layer privates (for old-API emulation) */
  511.  
  512.     UInt16                             scsiCurrentPhase;            /* <- phase upon completing old call                  */
  513.     short                             scsiSelector;                /* -> selector specified in old calls                  */
  514.     OSErr                             scsiOldCallResult;            /* <- result of old call                              */
  515.     UInt8                             scsiSCSImessage;            /* <- Returned scsi device message (for SCSIComplete)*/
  516.     UInt8                             XPTprivateFlags;            /* <> various flags                                   */
  517.     UInt8                             XPTextras[12];                /*                                                    */
  518. };
  519. typedef struct SCSI_IO                    SCSI_IO;
  520.  
  521. typedef SCSI_IO                         SCSIExecIOPB;
  522. /* Bus inquiry PB */
  523.  
  524. struct SCSIBusInquiryPB {
  525.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  526.     short                             scsiReserved1;                /* ->     reserved for input                */
  527.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  528.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  529.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  530.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  531.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  532.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  533.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  534.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  535.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  536.     long                             scsiReserved3;                /* reserved                                */
  537.  
  538.     UInt16                             scsiEngineCount;            /* <- Number of engines on HBA                         */
  539.     UInt16                             scsiMaxTransferType;        /* <- Number of transfer types for this HBA            */
  540.  
  541.     UInt32                             scsiDataTypes;                /* <- which data types are supported by this SIM     */
  542.  
  543.     UInt16                             scsiIOpbSize;                /* <- Size of SCSI_IO PB for this SIM/HBA             */
  544.     UInt16                             scsiMaxIOpbSize;            /* <- Size of max SCSI_IO PB for all SIM/HBAs         */
  545.  
  546.     UInt32                             scsiFeatureFlags;            /* <- Supported features flags field                 */
  547.  
  548.     UInt8                             scsiVersionNumber;            /* <- Version number for the SIM/HBA                 */
  549.     UInt8                             scsiHBAInquiry;                /* <- Mimic of INQ byte 7 for the HBA                 */
  550.     UInt8                             scsiTargetModeFlags;        /* <- Flags for target mode support                 */
  551.     UInt8                             scsiScanFlags;                /* <- Scan related feature flags                     */
  552.  
  553.     UInt32                             scsiSIMPrivatesPtr;            /* <- Ptr to SIM private data area                     */
  554.     UInt32                             scsiSIMPrivatesSize;        /* <- Size of SIM private data area                 */
  555.     UInt32                             scsiAsyncFlags;                /* <- Event cap. for Async Callback                 */
  556.  
  557.     UInt8                             scsiHiBusID;                /* <- Highest path ID in the subsystem              */
  558.     UInt8                             scsiInitiatorID;            /* <- ID of the HBA on the SCSI bus                 */
  559.     UInt16                             scsiBIReserved0;            /*                                                    */
  560.  
  561.     UInt32                             scsiBIReserved1;            /* <-                                                  */
  562.     UInt32                             scsiFlagsSupported;            /* <- which scsiFlags are supported                 */
  563.  
  564.     UInt16                             scsiIOFlagsSupported;        /* <- which scsiIOFlags are supported                 */
  565.     UInt16                             scsiWeirdStuff;                /* <-                                                 */
  566.     UInt16                             scsiMaxTarget;                /* <- maximum Target number supported                 */
  567.     UInt16                             scsiMaxLUN;                    /* <- maximum Logical Unit number supported         */
  568.  
  569.     char                             scsiSIMVendor[16];            /* <- Vendor ID of SIM (or XPT if bus<FF)         */
  570.     char                             scsiHBAVendor[16];            /* <- Vendor ID of the HBA                         */
  571.     char                             scsiControllerFamily[16];    /* <- Family of SCSI Controller                 */
  572.     char                             scsiControllerType[16];        /* <- Specific Model of SCSI Controller used     */
  573.  
  574.     char                             scsiXPTversion[4];            /* <- version number of XPT                         */
  575.     char                             scsiSIMversion[4];            /* <- version number of SIM                         */
  576.     char                             scsiHBAversion[4];            /* <- version number of HBA                         */
  577.  
  578.     UInt8                             scsiHBAslotType;            /* <- type of "slot" that this HBA is in            */
  579.     UInt8                             scsiHBAslotNumber;            /* <- slot number of this HBA                         */
  580.     UInt16                             scsiSIMsRsrcID;                /* <- resource ID of this SIM                         */
  581.  
  582.     UInt16                             scsiBIReserved3;            /* <-                                                 */
  583.     UInt16                             scsiAdditionalLength;        /* <- additional BusInquiry PB len                    */
  584. };
  585. typedef struct SCSIBusInquiryPB            SCSIBusInquiryPB;
  586. /* Abort SIM Request PB */
  587.  
  588. struct SCSIAbortCommandPB {
  589.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  590.     short                             scsiReserved1;                /* ->     reserved for input                */
  591.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  592.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  593.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  594.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  595.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  596.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  597.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  598.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  599.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  600.     long                             scsiReserved3;                /* reserved                                */
  601.     SCSI_IO *                        scsiIOptr;                    /* Pointer to the PB to abort            */
  602. };
  603. typedef struct SCSIAbortCommandPB        SCSIAbortCommandPB;
  604. /* Terminate I/O Process Request PB */
  605.  
  606. struct SCSITerminateIOPB {
  607.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  608.     short                             scsiReserved1;                /* ->     reserved for input                */
  609.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  610.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  611.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  612.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  613.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  614.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  615.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  616.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  617.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  618.     long                             scsiReserved3;                /* reserved                                */
  619.     SCSI_IO *                        scsiIOptr;                    /* Pointer to the PB to terminate         */
  620. };
  621. typedef struct SCSITerminateIOPB        SCSITerminateIOPB;
  622. /* Reset SCSI Bus PB */
  623.  
  624. struct SCSIResetBusPB {
  625.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  626.     short                             scsiReserved1;                /* ->     reserved for input                */
  627.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  628.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  629.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  630.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  631.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  632.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  633.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  634.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  635.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  636.     long                             scsiReserved3;                /* reserved                                */
  637. };
  638. typedef struct SCSIResetBusPB            SCSIResetBusPB;
  639. /* Reset SCSI Device PB */
  640.  
  641. struct SCSIResetDevicePB {
  642.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  643.     short                             scsiReserved1;                /* ->     reserved for input                */
  644.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  645.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  646.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  647.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  648.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  649.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  650.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  651.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  652.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  653.     long                             scsiReserved3;                /* reserved                                */
  654. };
  655. typedef struct SCSIResetDevicePB        SCSIResetDevicePB;
  656. /* Release SIM Queue PB */
  657.  
  658. struct SCSIReleaseQPB {
  659.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  660.     short                             scsiReserved1;                /* ->     reserved for input                */
  661.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  662.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  663.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  664.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  665.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  666.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  667.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  668.     BytePtr                         scsiDriverStorage;            /* <> Ptr for driver private use        */
  669.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  670.     long                             scsiReserved3;                /* reserved                                */
  671. };
  672. typedef struct SCSIReleaseQPB            SCSIReleaseQPB;
  673. /* SCSI Get Virtual ID Info PB */
  674.  
  675. struct SCSIGetVirtualIDInfoPB {
  676.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  677.     short                             scsiReserved1;                /* ->     reserved for input                */
  678.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  679.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  680.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  681.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  682.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  683.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  684.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  685.     Ptr                             scsiDriverStorage;            /* <> Ptr for driver private use        */
  686.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  687.     long                             scsiReserved3;                /* reserved                                */
  688.     UInt16                             scsiOldCallID;                /* -> SCSI ID of device in question     */
  689.     Boolean                         scsiExists;                    /* <- true if device exists             */
  690.     SInt8                             filler;
  691. };
  692. typedef struct SCSIGetVirtualIDInfoPB    SCSIGetVirtualIDInfoPB;
  693. /* Create/Lookup/Remove RefNum for Device PB */
  694.  
  695. struct SCSIDriverPB {
  696.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  697.     short                             scsiReserved1;                /* ->     reserved for input                */
  698.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  699.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  700.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  701.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  702.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  703.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  704.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  705.     Ptr                             scsiDriverStorage;            /* <> Ptr for driver private use        */
  706.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  707.     long                             scsiReserved3;                /* reserved                                */
  708.     short                             scsiDriver;                    /* -> DriverRefNum, For SetDriver, <- For GetNextDriver */
  709.     UInt16                             scsiDriverFlags;            /* <> Details of driver/device             */
  710.     DeviceIdent                     scsiNextDevice;                /* <- DeviceIdent of the NEXT Item in the list  */
  711. };
  712. typedef struct SCSIDriverPB                SCSIDriverPB;
  713. /* Load Driver PB */
  714.  
  715. struct SCSILoadDriverPB {
  716.     SCSIHdr *                        qLink;                        /* (internal use, must be nil on entry)    */
  717.     short                             scsiReserved1;                /* ->     reserved for input                */
  718.     UInt16                             scsiPBLength;                /* -> Length of the entire PB            */
  719.     UInt8                             scsiFunctionCode;            /* -> function selector                 */
  720.     UInt8                             scsiReserved2;                /* <-     reserved for output                */
  721.     volatile OSErr                     scsiResult;                    /* <- Returned result                     */
  722.     DeviceIdent                     scsiDevice;                    /* -> Device Identifier (bus+target+lun)*/
  723.     SCSICallbackUPP                 scsiCompletion;                /* -> Callback on completion function      */
  724.     UInt32                             scsiFlags;                    /* -> assorted flags                    */
  725.     Ptr                             scsiDriverStorage;            /* <> Ptr for driver private use        */
  726.     Ptr                             scsiXPTprivate;                /* private field for use in XPT            */
  727.     long                             scsiReserved3;                /* reserved                                */
  728.     short                             scsiLoadedRefNum;            /* <- SIM returns refnum of driver         */
  729.     Boolean                         scsiDiskLoadFailed;            /* -> if true, indicates call after failure to load */
  730.     SInt8                             filler;
  731. };
  732. typedef struct SCSILoadDriverPB            SCSILoadDriverPB;
  733.  
  734. /* Defines for the scsiTransferType field */
  735. enum {
  736.     scsiTransferBlind            = 0,
  737.     scsiTransferPolled            = 1
  738. };
  739.  
  740. enum {
  741.     scsiErrorBase                = -7936
  742. };
  743.  
  744. enum {
  745.     scsiRequestInProgress        = 1,                            /* 1     = PB request is in progress             */
  746.                                                                 /* Execution failed  00-2F */
  747.     scsiRequestAborted            = scsiErrorBase + 2,            /* -7934 = PB request aborted by the host         */
  748.     scsiUnableToAbort            = scsiErrorBase + 3,            /* -7933 = Unable to Abort PB request             */
  749.     scsiNonZeroStatus            = scsiErrorBase + 4,            /* -7932 = PB request completed with an err     */
  750.     scsiUnused05                = scsiErrorBase + 5,            /* -7931 =                                      */
  751.     scsiUnused06                = scsiErrorBase + 6,            /* -7930 =                                      */
  752.     scsiUnused07                = scsiErrorBase + 7,            /* -7929 =                                      */
  753.     scsiUnused08                = scsiErrorBase + 8,            /* -7928 =                                      */
  754.     scsiUnableToTerminate        = scsiErrorBase + 9,            /* -7927 = Unable to Terminate I/O PB req         */
  755.     scsiSelectTimeout            = scsiErrorBase + 10,            /* -7926 = Target selection timeout             */
  756.     scsiCommandTimeout            = scsiErrorBase + 11,            /* -7925 = Command timeout                      */
  757.     scsiIdentifyMessageRejected    = scsiErrorBase + 12,            /* -7924 =                                      */
  758.     scsiMessageRejectReceived    = scsiErrorBase + 13,            /* -7923 = Message reject received                 */
  759.     scsiSCSIBusReset            = scsiErrorBase + 14,            /* -7922 = SCSI bus reset sent/received         */
  760.     scsiParityError                = scsiErrorBase + 15,            /* -7921 = Uncorrectable parity error occured     */
  761.     scsiAutosenseFailed            = scsiErrorBase + 16,            /* -7920 = Autosense: Request sense cmd fail     */
  762.     scsiUnused11                = scsiErrorBase + 17,            /* -7919 =                                      */
  763.     scsiDataRunError            = scsiErrorBase + 18,            /* -7918 = Data overrun/underrun error          */
  764.     scsiUnexpectedBusFree        = scsiErrorBase + 19,            /* -7917 = Unexpected BUS free                     */
  765.     scsiSequenceFailed            = scsiErrorBase + 20,            /* -7916 = Target bus phase sequence failure     */
  766.     scsiWrongDirection            = scsiErrorBase + 21,            /* -7915 = Data phase was in wrong direction     */
  767.     scsiUnused16                = scsiErrorBase + 22,            /* -7914 =                                      */
  768.     scsiBDRsent                    = scsiErrorBase + 23,            /* -7913 = A SCSI BDR msg was sent to target     */
  769.     scsiTerminated                = scsiErrorBase + 24,            /* -7912 = PB request terminated by the host     */
  770.     scsiNoNexus                    = scsiErrorBase + 25,            /* -7911 = Nexus is not established             */
  771.     scsiCDBReceived                = scsiErrorBase + 26,            /* -7910 = The SCSI CDB has been received         */
  772.                                                                 /* Couldn't begin execution  30-3F */
  773.     scsiTooManyBuses            = scsiErrorBase + 48,            /* -7888 = Register failed because we're full    */
  774.     scsiBusy                    = scsiErrorBase + 49,            /* -7887 = SCSI subsystem is busy                 */
  775.     scsiProvideFail                = scsiErrorBase + 50,            /* -7886 = Unable to provide requ. capability    */
  776.     scsiDeviceNotThere            = scsiErrorBase + 51,            /* -7885 = SCSI device not installed/there      */
  777.     scsiNoHBA                    = scsiErrorBase + 52,            /* -7884 = No HBA detected Error                 */
  778.     scsiDeviceConflict            = scsiErrorBase + 53,            /* -7883 = sorry, max 1 refNum per DeviceIdent     */
  779.     scsiNoSuchXref                = scsiErrorBase + 54,            /* -7882 = no such RefNum xref                     */
  780.     scsiQLinkInvalid            = scsiErrorBase + 55,            /* -7881 = pre-linked PBs not supported            */
  781.                                                                 /*   (The QLink field was nonzero)                */
  782.                                                                 /* Parameter errors  40-7F */
  783.     scsiPBLengthError            = scsiErrorBase + 64,            /* -7872 = (scsiPBLength is insuf'ct/invalid     */
  784.     scsiFunctionNotAvailable    = scsiErrorBase + 65,            /* -7871 = The requ. func is not available      */
  785.     scsiRequestInvalid            = scsiErrorBase + 66,            /* -7870 = PB request is invalid                 */
  786.     scsiBusInvalid                = scsiErrorBase + 67,            /* -7869 = Bus ID supplied is invalid              */
  787.     scsiTIDInvalid                = scsiErrorBase + 68,            /* -7868 = Target ID supplied is invalid         */
  788.     scsiLUNInvalid                = scsiErrorBase + 69,            /* -7867 = LUN supplied is invalid              */
  789.     scsiIDInvalid                = scsiErrorBase + 70,            /* -7866 = The initiator ID is invalid          */
  790.     scsiDataTypeInvalid            = scsiErrorBase + 71,            /* -7865 = scsiDataType requested not supported */
  791.     scsiTransferTypeInvalid        = scsiErrorBase + 72,            /* -7864 = scsiTransferType field is too high     */
  792.     scsiCDBLengthInvalid        = scsiErrorBase + 73            /* -7863 = scsiCDBLength field is too big         */
  793. };
  794.  
  795. /* New errors for SCSI Family         */
  796. enum {
  797.     scsiUnused74                = scsiErrorBase + 74,            /* -7862 =                                          */
  798.     scsiUnused75                = scsiErrorBase + 75,            /* -7861 =                                         */
  799.     scsiBadDataLength            = scsiErrorBase + 76,            /* -7860 = a zero data length in PB             */
  800.     scsiPartialPrepared            = scsiErrorBase + 77,            /* -7859 = could not do full prepare mem for I/O*/
  801.     scsiInvalidMsgType            = scsiErrorBase + 78,            /* -7858 = Invalid message type (internal)        */
  802.     scsiUnused79                = scsiErrorBase + 79,            /* -7857 =                                           */
  803.     scsiBadConnID                = scsiErrorBase + 80,            /* -7856 = Bad Connection ID                      */
  804.     scsiUnused81                = scsiErrorBase + 81,            /* -7855 =                                         */
  805.     scsiIOInProgress            = scsiErrorBase + 82,            /* -7854 = Can't close conn, IO in prog            */
  806.     scsiTargetReserved            = scsiErrorBase + 83,            /* -7853 = Target already reserved                */
  807.     scsiUnused84                = scsiErrorBase + 84,            /* -7852 =                                         */
  808.     scsiUnused85                = scsiErrorBase + 85,            /* -7851 =                                         */
  809.     scsiBadConnType                = scsiErrorBase + 86,            /* -7850 = Bad connection type                    */
  810.     scsiCannotLoadPlugin        = scsiErrorBase + 87            /* -7849 = No matching service category            */
  811. };
  812.  
  813. /* +++ */
  814. /*
  815.  * scsiFamilyInternalError and scsiPluginInternalError are intended to handle consistency check failures.
  816.  * For example, if the family stores a record on a lookaside queue, but does not find that record
  817.  * it can use this error to report this failure. SCSI Manager 4.3 uses dsIOCoreErr in a few places,
  818.  * but this is probably not the best error. In general, internal errors should be reported as bugs.
  819.  *
  820.  * The following range of errors is provided for third-party (non-Apple) SCSI SIM and device driver vendors.
  821.  * In general, they would be used for error conditions that are not covered by the standardized errors.
  822.  * They should not normally be conveyed to normal applications, but might be used for communication between
  823.  * a plug-in and a vendor-provided device driver (for example, to manage RAID hot-swapping).
  824.  *
  825.  * Note: I don't know how many SCSI errors are reserved in the error code architecture. Don't assume that
  826.  * we'll actually get sixteen, but we should reserve at least one.
  827.  */
  828. enum {
  829.     scsiFamilyInternalError        = scsiErrorBase + 87,            /* -7849 = Internal consistency check failed    */
  830.     scsiPluginInternalError        = scsiErrorBase + 88,            /* -7848 = Internal consistency check failed    */
  831.     scsiVendorSpecificErrorBase    = scsiErrorBase + 128,            /* ??    = Start of third-party error range        */
  832.     scsiVendorSpecificErrorCount = 16                            /* Number of third-party errors                    */
  833. };
  834.  
  835. /* --- */
  836. enum {
  837.     scsiExecutionErrors            = scsiErrorBase,
  838.     scsiNotExecutedErrors        = scsiTooManyBuses,
  839.     scsiParameterErrors            = scsiPBLengthError
  840. };
  841.  
  842. /* Defines for the scsiResultFlags field */
  843. enum {
  844.     scsiSIMQFrozen                = 0x0001,                        /* The SIM queue is frozen w/this err            */
  845.     scsiAutosenseValid            = 0x0002,                        /* Autosense data valid for target              */
  846.     scsiBusNotFree                = 0x0004                        /* At time of callback, SCSI bus is not free    */
  847. };
  848.  
  849. /* Defines for the bit numbers of the scsiFlags field in the PB header for the SCSIExecIO function */
  850. enum {
  851.     kbSCSIDisableAutosense        = 29,                            /* Disable auto sense feature                     */
  852.     kbSCSIFlagReservedA            = 28,                            /*                                              */
  853.     kbSCSIFlagReserved0            = 27,                            /*                                              */
  854.     kbSCSICDBLinked                = 26,                            /* The PB contains a linked CDB                    */
  855.     kbSCSIQEnable                = 25,                            /* Target queue actions are enabled                */
  856.     kbSCSICDBIsPointer            = 24,                            /* The CDB field contains a pointer                */
  857.     kbSCSIFlagReserved1            = 23,                            /*                                                 */
  858.     kbSCSIInitiateSyncData        = 22,                            /* Attempt Sync data xfer and SDTR                */
  859.     kbSCSIDisableSyncData        = 21,                            /* Disable sync, go to async                    */
  860.     kbSCSISIMQHead                = 20,                            /* Place PB at the head of SIM Q                */
  861.     kbSCSISIMQFreeze            = 19,                            /* Return the SIM Q to frozen state                */
  862.     kbSCSISIMQNoFreeze            = 18,                            /* Disallow SIM Q freezing                        */
  863.     kbSCSIDoDisconnect            = 17,                            /* Definitely do disconnect                        */
  864.     kbSCSIDontDisconnect        = 16,                            /* Definitely don't disconnect                    */
  865.     kbSCSIDataReadyForDMA        = 15,                            /* Data buffer(s) are ready for DMA                */
  866.     kbSCSIFlagReserved3            = 14,                            /*                                                 */
  867.     kbSCSIDataPhysical            = 13,                            /* SG/Buffer data ptrs are physical                */
  868.     kbSCSISensePhysical            = 12,                            /* Autosense buffer ptr is physical                */
  869.     kbSCSIFlagReserved5            = 11,                            /*                                                 */
  870.     kbSCSIFlagReserved6            = 10,                            /*                                                 */
  871.     kbSCSIFlagReserved7            = 9,                            /*                                                 */
  872.     kbSCSIFlagReserved8            = 8,                            /*                                                 */
  873.     kbSCSIDataBufferValid        = 7,                            /* Data buffer valid                            */
  874.     kbSCSIStatusBufferValid        = 6,                            /* Status buffer valid                             */
  875.     kbSCSIMessageBufferValid    = 5,                            /* Message buffer valid                            */
  876.     kbSCSIFlagReserved9            = 4                                /*                                              */
  877. };
  878.  
  879. /* Defines for the bit masks of the scsiFlags field */
  880. enum {
  881.     scsiDirectionMask            = (long)0xC0000000,                /* Data direction mask                        */
  882.     scsiDirectionNone            = (long)0xC0000000,                /* Data direction (11: no data)                */
  883.     scsiDirectionReserved        = 0x00000000,                    /* Data direction (00: reserved)            */
  884.     scsiDirectionOut            = (long)0x80000000,                /* Data direction (10: DATA OUT)            */
  885.     scsiDirectionIn                = 0x40000000,                    /* Data direction (01: DATA IN)                */
  886.     scsiDisableAutosense        = 0x20000000,                    /* Disable auto sense feature                */
  887.     scsiFlagReservedA            = 0x10000000,                    /*                                             */
  888.     scsiFlagReserved0            = 0x08000000,                    /*                                             */
  889.     scsiCDBLinked                = 0x04000000,                    /* The PB contains a linked CDB                */
  890.     scsiQEnable                    = 0x02000000,                    /* Target queue actions are enabled            */
  891.     scsiCDBIsPointer            = 0x01000000,                    /* The CDB field contains a pointer            */
  892.     scsiFlagReserved1            = 0x00800000,                    /*                                             */
  893.     scsiInitiateSyncData        = 0x00400000,                    /* Attempt Sync data xfer and SDTR            */
  894.     scsiDisableSyncData            = 0x00200000,                    /* Disable sync, go to async                */
  895.     scsiSIMQHead                = 0x00100000,                    /* Place PB at the head of SIM Q            */
  896.     scsiSIMQFreeze                = 0x00080000,                    /* Return the SIM Q to frozen state            */
  897.     scsiSIMQNoFreeze            = 0x00040000,                    /* Disallow SIM Q freezing                    */
  898.     scsiDoDisconnect            = 0x00020000,                    /* Definitely do disconnect                    */
  899.     scsiDontDisconnect            = 0x00010000,                    /* Definitely don't disconnect                */
  900.     scsiDataReadyForDMA            = 0x00008000,                    /* Data buffer(s) are ready for DMA            */
  901.     scsiFlagReserved3            = 0x00004000,                    /*  */
  902.     scsiDataPhysical            = 0x00002000,                    /* SG/Buffer data ptrs are physical            */
  903.     scsiSensePhysical            = 0x00001000,                    /* Autosense buffer ptr is physical            */
  904.     scsiFlagReserved5            = 0x00000800,                    /*                                          */
  905.     scsiFlagReserved6            = 0x00000400,                    /*                                             */
  906.     scsiFlagReserved7            = 0x00000200,                    /*                                             */
  907.     scsiFlagReserved8            = 0x00000100                    /*                                             */
  908. };
  909.  
  910. /* bit masks for the scsiIOFlags field in SCSIExecIOPB */
  911. enum {
  912.     scsiNoParityCheck            = 0x0002,                        /* disable parity checking                             */
  913.     scsiDisableSelectWAtn        = 0x0004,                        /* disable select w/Atn                              */
  914.     scsiSavePtrOnDisconnect        = 0x0008,                        /* do SaveDataPointer upon Disconnect msg             */
  915.     scsiNoBucketIn                = 0x0010,                        /* don't bit bucket in during this I/O                 */
  916.     scsiNoBucketOut                = 0x0020,                        /* don't bit bucket out during this I/O             */
  917.     scsiDisableWide                = 0x0040,                        /* disable wide transfer negotiation                 */
  918.     scsiInitiateWide            = 0x0080,                        /* initiate wide transfer negotiation                 */
  919.     scsiRenegotiateSense        = 0x0100,                        /* renegotiate sync/wide before issuing autosense     */
  920.     scsiDisableDiscipline        = 0x0200,                        /* disable parameter checking on SCSIExecIO calls    */
  921.     scsiIOFlagReserved0080        = 0x0080,                        /*                                                  */
  922.     scsiIOFlagReserved8000        = 0x8000                        /*                                                     */
  923. };
  924.  
  925. /* Defines for the Bus Inquiry PB fields. */
  926. /* scsiHBAInquiry field bits */
  927. enum {
  928.     scsiBusMDP                    = 0x80,                            /* Supports Modify Data Pointer message                        */
  929.     scsiBusWide32                = 0x40,                            /* Supports 32 bit wide SCSI                                */
  930.     scsiBusWide16                = 0x20,                            /* Supports 16 bit wide SCSI                                */
  931.     scsiBusSDTR                    = 0x10,                            /* Supports Sync Data Transfer Req message                    */
  932.     scsiBusLinkedCDB            = 0x08,                            /* Supports linked CDBs                                        */
  933.     scsiBusTagQ                    = 0x02,                            /* Supports tag queue message                                */
  934.     scsiBusSoftReset            = 0x01                            /* Supports soft reset                                        */
  935. };
  936.  
  937. /* Defines for the scsiDataType field */
  938. enum {
  939.     scsiDataBuffer                = 0,                            /* single contiguous buffer supplied                  */
  940.     scsiDataTIB                    = 1,                            /* TIB supplied (ptr in scsiDataPtr)                 */
  941.     scsiDataSG                    = 2,                            /* scatter/gather list supplied                      */
  942.     scsiDataIOTable                = 3                                /*#(7/11/95) Prepared by Block Storage              */
  943. };
  944.  
  945. /* scsiDataTypes field bits  */
  946. /*    bits 0->15 Apple-defined, 16->30 3rd-party unique, 31 = reserved */
  947. enum {
  948.     scsiBusDataTIB                = (1 << scsiDataTIB),            /* TIB supplied (ptr in scsiDataPtr)        */
  949.     scsiBusDataBuffer            = (1 << scsiDataBuffer),        /* single contiguous buffer supplied         */
  950.     scsiBusDataSG                = (1 << scsiDataSG),            /* scatter/gather list supplied             */
  951.     scsiBusDataIOTable            = (1 << scsiDataIOTable),        /* (2/6/95) Prepare Memory for IO*/
  952.     scsiBusDataReserved            = (long)0x80000000                /*                                           */
  953. };
  954.  
  955. /* scsiScanFlags field bits */
  956. enum {
  957.     scsiBusScansDevices            = 0x80,                            /* Bus scans for and maintains device list            */
  958.     scsiBusScansOnInit            = 0x40,                            /* Bus scans performed at power-up/reboot            */
  959.     scsiBusLoadsROMDrivers        = 0x20                            /* may load ROM drivers to support targets             */
  960. };
  961.  
  962. /* scsiFeatureFlags field bits */
  963. enum {
  964.     scsiBusLVD                    = 0x00000400,                    /* HBA is Low Voltage Differential Bus            */
  965.     scsiBusUltra3SCSI            = 0x00000200,                    /* HBA supports Ultra3 SCSI                        */
  966.     scsiBusUltra2SCSI            = 0x00000100,                    /* HBA supports Ultra2 SCSI                        */
  967.     scsiBusInternalExternalMask    = 0x000000C0,                    /* bus internal/external mask                    */
  968.     scsiBusInternalExternalUnknown = 0x00000000,                /* not known whether bus is inside or outside     */
  969.     scsiBusInternalExternal        = 0x000000C0,                    /* bus goes inside and outside the box             */
  970.     scsiBusInternal                = 0x00000080,                    /* bus goes inside the box                         */
  971.     scsiBusExternal                = 0x00000040,                    /* bus goes outside the box                     */
  972.     scsiBusCacheCoherentDMA        = 0x00000020,                    /* DMA is cache coherent                         */
  973.     scsiBusOldCallCapable        = 0x00000010,                    /* SIM is old call capable                         */
  974.     scsiBusUltraSCSI            = 0x00000008,                    /* HBA supports Ultra SCSI                        */
  975.     scsiBusDifferential            = 0x00000004,                    /* Single Ended (0) or Differential (1)         */
  976.     scsiBusFastSCSI                = 0x00000002,                    /* HBA supports fast SCSI                         */
  977.     scsiBusDMAavailable            = 0x00000001                    /* DMA is available                             */
  978. };
  979.  
  980. /* scsiWeirdStuff field bits */
  981. enum {
  982.     scsiOddDisconnectUnsafeRead1 = 0x0001,                        /* Disconnects on odd byte boundries are unsafe with DMA and/or blind reads */
  983.     scsiOddDisconnectUnsafeWrite1 = 0x0002,                        /* Disconnects on odd byte boundries are unsafe with DMA and/or blind writes */
  984.     scsiBusErrorsUnsafe            = 0x0004,                        /* Non-handshaked delays or disconnects during blind transfers may cause a crash */
  985.     scsiRequiresHandshake        = 0x0008,                        /* Non-handshaked delays or disconnects during blind transfers may cause data corruption */
  986.     scsiTargetDrivenSDTRSafe    = 0x0010,                        /* Targets which initiate synchronous negotiations are supported */
  987.     scsiOddCountForPhysicalUnsafe = 0x0020,                        /* If using physical addrs all counts must be even, and disconnects must be on even boundries */
  988.     scsiAbortCmdFixed            = 0x0040,                        /* Set if abort command is fixed to properly make callbacks */
  989.     scsiMeshACKTimingFixed        = 0x0080                        /* Set if bug allowing Mesh to release ACK prematurely is fixed */
  990. };
  991.  
  992. /* scsiHBAslotType values */
  993. enum {
  994.     scsiMotherboardBus            = 0x00,                            /* A built in Apple supplied bus                     */
  995.     scsiNuBus                    = 0x01,                            /* A SIM on a NuBus card                             */
  996.     scsiPDSBus                    = 0x03,                            /*    "  on a PDS card                                */
  997.     scsiPCIBus                    = 0x04,                            /*    "  on a PCI bus card                            */
  998.     scsiPCMCIABus                = 0x05,                            /*    "  on a PCMCIA card                            */
  999.     scsiFireWireBridgeBus        = 0x06                            /*    "  connected through a FireWire bridge        */
  1000. };
  1001.  
  1002. /* Defines for the scsiDriverFlags field (in SCSIDriverPB) */
  1003. enum {
  1004.     scsiDeviceSensitive            = 0x0001,                        /* Only driver should access this device                */
  1005.     scsiDeviceNoOldCallAccess    = 0x0002                        /* no old call access to this device                     */
  1006. };
  1007.  
  1008. /*  SIMInitInfo PB */
  1009. /* directions are for SCSIRegisterBus call ( -> parm, <- result)             */
  1010.  
  1011. struct SIMInitInfo {
  1012.     Ptr                             SIMstaticPtr;                /* <- alloc. ptr to the SIM's static vars                 */
  1013.     long                             staticSize;                    /* -> num bytes SIM needs for static vars                 */
  1014.     SIMInitUPP                         SIMInit;                    /* -> pointer to the SIM init routine                     */
  1015.     SIMActionUPP                     SIMAction;                    /* -> pointer to the SIM action routine                 */
  1016.     SCSIInterruptUPP                 SIM_ISR;                    /*       reserved                                             */
  1017.     SCSIInterruptUPP                 SIMInterruptPoll;            /* -> pointer to the SIM interrupt poll routine            */
  1018.     SIMActionUPP                     NewOldCall;                    /* -> pointer to the SIM NewOldCall routine                */
  1019.     UInt16                             ioPBSize;                    /* -> size of SCSI_IO_PBs required for this SIM            */
  1020.     Boolean                         oldCallCapable;                /* -> true if this SIM can handle old-API calls            */
  1021.     UInt8                             simInfoUnused1;                /*       reserved                                            */
  1022.     long                             simInternalUse;                /* xx not affected or viewed by XPT                        */
  1023.     SCSIUPP                         XPT_ISR;                    /*    reserved                                            */
  1024.     SCSIUPP                         EnteringSIM;                /* <- ptr to the EnteringSIM routine                    */
  1025.     SCSIUPP                         ExitingSIM;                    /* <- ptr to the ExitingSIM routine                        */
  1026.     SCSIMakeCallbackUPP             MakeCallback;                /* <- the XPT layer's SCSIMakeCallback routine            */
  1027.     UInt16                             busID;                        /* <- bus number for the registered bus                    */
  1028.     UInt8                             simSlotNumber;                /* <- Magic cookie to place in scsiHBASlotNumber (PCI)    */
  1029.     UInt8                             simSRsrcID;                    /* <- Magic cookie to place in scsiSIMsRsrcID     (PCI)    */
  1030.     Ptr                             simRegEntry;                /* -> The SIM's RegEntryIDPtr                     (PCI)    */
  1031. };
  1032. typedef struct SIMInitInfo                SIMInitInfo;
  1033. /* Glue between SCSI calls and SCSITrap format */
  1034. enum {
  1035.     xptSCSIAction                = 0x0001,
  1036.     xptSCSIRegisterBus            = 0x0002,
  1037.     xptSCSIDeregisterBus        = 0x0003,
  1038.     xptSCSIReregisterBus        = 0x0004,
  1039.     xptSCSIKillXPT                = 0x0005,                        /* kills Mini-XPT after transition */
  1040.     xptSCSIInitialize            = 0x000A                        /* Initialize the SCSI manager */
  1041. };
  1042.  
  1043. /*
  1044.  * SCSI bus status. These values are returned by the SCSI target in the status phase.
  1045.  * They are not related to Macintosh status values (except that values other than
  1046.  * scsiStatusGood will result in scsiResult set to scsiNonZeroStatus).
  1047.  */
  1048. enum {
  1049.     scsiStatGood                = 0x00,                            /* Good Status*/
  1050.     scsiStatCheckCondition        = 0x02,                            /* Check Condition*/
  1051.     scsiStatConditionMet        = 0x04,                            /* Condition Met*/
  1052.     scsiStatBusy                = 0x08,                            /* Busy*/
  1053.     scsiStatIntermediate        = 0x10,                            /* Intermediate*/
  1054.     scsiStatIntermedMet            = 0x14,                            /* Intermediate - Condition Met*/
  1055.     scsiStatResvConflict        = 0x18,                            /* Reservation conflict*/
  1056.     scsiStatTerminated            = 0x22,                            /* Command terminated*/
  1057.     scsiStatQFull                = 0x28                            /* Queue full*/
  1058. };
  1059.  
  1060. /* SCSI messages*/
  1061. enum {
  1062.     kCmdCompleteMsg                = 0,
  1063.     kExtendedMsg                = 1,                            /* 0x01*/
  1064.     kSaveDataPointerMsg            = 2,                            /* 0x02*/
  1065.     kRestorePointersMsg            = 3,                            /* 0x03*/
  1066.     kDisconnectMsg                = 4,                            /* 0x04*/
  1067.     kInitiatorDetectedErrorMsg    = 5,                            /* 0x05*/
  1068.     kAbortMsg                    = 6,                            /* 0x06*/
  1069.     kMsgRejectMsg                = 7,                            /* 0x07*/
  1070.     kNoOperationMsg                = 8,                            /* 0x08*/
  1071.     kMsgParityErrorMsg            = 9,                            /* 0x09*/
  1072.     kLinkedCmdCompleteMsg        = 10,                            /* 0x0a*/
  1073.     kLinkedCmdCompleteWithFlagMsg = 11,                            /* 0x0b*/
  1074.     kBusDeviceResetMsg            = 12,                            /* 0x0c*/
  1075.     kAbortTagMsg                = 13,                            /* 0x0d*/
  1076.     kClearQueueMsg                = 14,                            /* 0x0e*/
  1077.     kInitiateRecoveryMsg        = 15,                            /* 0x0f*/
  1078.     kReleaseRecoveryMsg            = 16,                            /* 0x10*/
  1079.     kTerminateIOProcessMsg        = 17,                            /* 0x11*/
  1080.     kSimpleQueueTag                = 0x20,                            /* 0x20*/
  1081.     kHeadOfQueueTagMsg            = 0x21,                            /* 0x21*/
  1082.     kOrderedQueueTagMsg            = 0x22,                            /* 0x22*/
  1083.     kIgnoreWideResidueMsg        = 0x23                            /* 0x23*/
  1084. };
  1085.  
  1086.  
  1087. /* moveq #kSCSIx, D0;  _SCSIAtomic */
  1088.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1089.                                                                                             #pragma parameter __D0 SCSIAction(__A0)
  1090.                                                                                             #endif
  1091. EXTERN_API( OSErr )
  1092. SCSIAction                        (SCSI_PB *                parameterBlock)                        TWOWORDINLINE(0x7001, 0xA089);
  1093.  
  1094.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1095.                                                                                             #pragma parameter __D0 SCSIRegisterBus(__A0)
  1096.                                                                                             #endif
  1097. EXTERN_API( OSErr )
  1098. SCSIRegisterBus                    (SIMInitInfo *            parameterBlock)                        TWOWORDINLINE(0x7002, 0xA089);
  1099.  
  1100.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1101.                                                                                             #pragma parameter __D0 SCSIDeregisterBus(__A0)
  1102.                                                                                             #endif
  1103. EXTERN_API( OSErr )
  1104. SCSIDeregisterBus                (SCSI_PB *                parameterBlock)                        TWOWORDINLINE(0x7003, 0xA089);
  1105.  
  1106.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1107.                                                                                             #pragma parameter __D0 SCSIReregisterBus(__A0)
  1108.                                                                                             #endif
  1109. EXTERN_API( OSErr )
  1110. SCSIReregisterBus                (SIMInitInfo *            parameterBlock)                        TWOWORDINLINE(0x7004, 0xA089);
  1111.  
  1112.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1113.                                                                                             #pragma parameter __D0 SCSIKillXPT(__A0)
  1114.                                                                                             #endif
  1115. EXTERN_API( OSErr )
  1116. SCSIKillXPT                        (SIMInitInfo *            parameterBlock)                        TWOWORDINLINE(0x7005, 0xA089);
  1117.  
  1118.  
  1119.  
  1120. #if PRAGMA_STRUCT_ALIGN
  1121.     #pragma options align=reset
  1122. #elif PRAGMA_STRUCT_PACKPUSH
  1123.     #pragma pack(pop)
  1124. #elif PRAGMA_STRUCT_PACK
  1125.     #pragma pack()
  1126. #endif
  1127.  
  1128. #ifdef PRAGMA_IMPORT_OFF
  1129. #pragma import off
  1130. #elif PRAGMA_IMPORT
  1131. #pragma import reset
  1132. #endif
  1133.  
  1134. #ifdef __cplusplus
  1135. }
  1136. #endif
  1137.  
  1138. #endif /* __SCSI__ */
  1139.  
  1140.